package view;

import java.awt.Graphics;
import java.awt.Image;
import java.awt.event.ActionListener;

import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;


/**
 * This menu is invoked when the user creates a new game.
 * This allows the user to pick the occupation of the avator 
 * they will use to play the RPG and then sends this information
 * in order to begin a new game.
 * 
 * @author Stephanie
 *
 */
public class OccupationChooserMenu extends JPanel {
	
	public static final String ID = "OCCUPATION_CHOOSER_MENU";
	
	private MainFrame mainFrame;
	
	private JButton summonerButton;
	private JButton sneakButton;
	private JButton smasherButton;
	private JButton backButton;
	
	private ImageIcon summoner;
	private ImageIcon smasher;
	private ImageIcon sneak;
	
	private JLabel summonerLabel;
	private JLabel sneakLabel;
	private JLabel smasherLabel;
	
	public OccupationChooserMenu( MainFrame mainFrame ) {
		this.mainFrame = mainFrame;
		
		setLayout(null);
		
		setSize(800,600);
		setLocation(0,0);
		setVisible(true);
		
		summoner = new ImageIcon("images/Avatars/summoner2.png");
		smasher = new ImageIcon("images/Avatars/smasher2.png");
		sneak = new ImageIcon("images/Avatars/sneak2.png");
		
		summonerButton = new JButton("Summoner");
		summonerButton.setSize(150,30);
		summonerButton.setLocation(85,250);
		summonerButton.setToolTipText("Specialized in spell-casting");
		summonerButton.setVisible(true);
		
		summonerLabel = new JLabel(summoner);
		summonerLabel.setSize(40,60);
		summonerLabel.setLocation(140,175);
		add(summonerLabel);
		
		sneakButton = new JButton("Sneak");
		sneakButton.setSize(150,30);
		sneakButton.setLocation(245,250);
		sneakButton.setToolTipText("Specialized in ranged weapons, evading detection, and finding/removing traps");
		sneakButton.setVisible(true);
		
		sneakLabel = new JLabel(sneak);
		sneakLabel.setSize(40,60);
		sneakLabel.setLocation(310,175);
		add(sneakLabel);
		
		smasherButton = new JButton("Smasher");
		smasherButton.setSize(150,30);
		smasherButton.setLocation(405,250);
		smasherButton.setToolTipText("Specialized in hand-to-hand combat");
		smasherButton.setVisible(true);
		
		smasherLabel = new JLabel(smasher);
		smasherLabel.setSize(40,60);
		smasherLabel.setLocation(470,175);
		add(smasherLabel);
		
		backButton = new JButton("Back");
		backButton.setSize(150,30);
		backButton.setLocation(565,250);
		backButton.setVisible(true);
		
		add(summonerButton);
		add(sneakButton);
		add(smasherButton);
		add(backButton);
		
	}
	
	public void addNewGameListener( ActionListener listener ) {
		sneakButton.addActionListener( listener );
		summonerButton.addActionListener( listener );
		smasherButton.addActionListener( listener );
	}
	
	//I (Paul) added these so we can know which Avatar to create...
	public void addSmasherListener(ActionListener listener){
		smasherButton.addActionListener(listener);
	}
	public void addSummonerListener(ActionListener listener){
		summonerButton.addActionListener(listener);
	}
	public void addSneakListener(ActionListener listener){
		sneakButton.addActionListener(listener);
	}
	
	public void addBackListener( ActionListener listener ) {
		backButton.addActionListener(listener);
	}

}
